<%@page import="java.util.Vector"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	String ID = request.getParameter("ID");
	System.out.println(ID);
	String cart[] = new String[10];
	Boolean exist = false;
	if (session.getAttribute("cart")==null) {
		cart[0] = ID;
	} else {
		cart = (String[])session.getValue("cart");
		int i = 0;
		while(i <= 9 && cart[i] != null) {
			if (cart[i].equals(ID)) exist = true;
			i++;
		}
		if (!exist) cart[i] = ID;
	}
	session.putValue("cart", cart);
	session.putValue("exist", exist);
	int j = 0;
	while (cart[j] != null) {
		System.out.println(j+" "+cart[j]);
		j++;
	}
	response.sendRedirect("cart.jsp");
%>
</body>
</html>